package com.woniuxy.cloud.ticket.ticketgateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import reactor.core.publisher.Mono;

@SpringBootApplication
public class TicketGatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(TicketGatewayApplication.class, args);
    }

    /**
     * redis限流的key
     *
     * @return
     */
    @Bean
    public KeyResolver userKeyResolver() {
        return exchange -> {
            return Mono.just(exchange.getRequest().getPath().toString());
        };
    }
}
